package com.wqm.cn.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
/**
*
*  @author wqm
*/
public class DAPORTFILE implements Serializable {

    private static final long serialVersionUID = 1607691500193L;


    /**
    * 主键
    * 文件ID
    * isNullAble:0
    */
    private Integer ID;

    /**
    * 文件名
    * isNullAble:0
    */
    private String fILENAME;

    /**
    * 文件路径
    * isNullAble:0
    */
    private String fILEPATH;

    /**
    * 文件拥有者
    * isNullAble:1
    */
    private String fILEOWNER;

    /**
    * 描述
    * isNullAble:1
    */
    private String DESCRIPTION;


    public void setID(Integer ID){this.ID = ID;}

    public Integer getID(){return this.ID;}

    public void setFILENAME(String fILENAME){this.fILENAME = fILENAME;}

    public String getFILENAME(){return this.fILENAME;}

    public void setFILEPATH(String fILEPATH){this.fILEPATH = fILEPATH;}

    public String getFILEPATH(){return this.fILEPATH;}

    public void setFILEOWNER(String fILEOWNER){this.fILEOWNER = fILEOWNER;}

    public String getFILEOWNER(){return this.fILEOWNER;}

    public void setDESCRIPTION(String DESCRIPTION){this.DESCRIPTION = DESCRIPTION;}

    public String getDESCRIPTION(){return this.DESCRIPTION;}
    @Override
    public String toString() {
        return "DAPORTFILE{" +
                "ID='" + ID + '\'' +
                "fILENAME='" + fILENAME + '\'' +
                "fILEPATH='" + fILEPATH + '\'' +
                "fILEOWNER='" + fILEOWNER + '\'' +
                "DESCRIPTION='" + DESCRIPTION + '\'' +
            '}';
    }

    public static Builder Build(){return new Builder();}

    public static ConditionBuilder ConditionBuild(){return new ConditionBuilder();}

    public static UpdateBuilder UpdateBuild(){return new UpdateBuilder();}

    public static QueryBuilder QueryBuild(){return new QueryBuilder();}

    public static class UpdateBuilder {

        private DAPORTFILE set;

        private ConditionBuilder where;

        public UpdateBuilder set(DAPORTFILE set){
            this.set = set;
            return this;
        }

        public DAPORTFILE getSet(){
            return this.set;
        }

        public UpdateBuilder where(ConditionBuilder where){
            this.where = where;
            return this;
        }

        public ConditionBuilder getWhere(){
            return this.where;
        }

        public UpdateBuilder build(){
            return this;
        }
    }

    public static class QueryBuilder extends DAPORTFILE{
        /**
        * 需要返回的列
        */
        private Map<String,Object> fetchFields;

        public Map<String,Object> getFetchFields(){return this.fetchFields;}

        private List<Integer> IDList;

        public List<Integer> getIDList(){return this.IDList;}

        private Integer IDSt;

        private Integer IDEd;

        public Integer getIDSt(){return this.IDSt;}

        public Integer getIDEd(){return this.IDEd;}

        private List<String> fILENAMEList;

        public List<String> getFILENAMEList(){return this.fILENAMEList;}


        private List<String> fuzzyFILENAME;

        public List<String> getFuzzyFILENAME(){return this.fuzzyFILENAME;}

        private List<String> rightFuzzyFILENAME;

        public List<String> getRightFuzzyFILENAME(){return this.rightFuzzyFILENAME;}
        private List<String> fILEPATHList;

        public List<String> getFILEPATHList(){return this.fILEPATHList;}


        private List<String> fuzzyFILEPATH;

        public List<String> getFuzzyFILEPATH(){return this.fuzzyFILEPATH;}

        private List<String> rightFuzzyFILEPATH;

        public List<String> getRightFuzzyFILEPATH(){return this.rightFuzzyFILEPATH;}
        private List<String> fILEOWNERList;

        public List<String> getFILEOWNERList(){return this.fILEOWNERList;}


        private List<String> fuzzyFILEOWNER;

        public List<String> getFuzzyFILEOWNER(){return this.fuzzyFILEOWNER;}

        private List<String> rightFuzzyFILEOWNER;

        public List<String> getRightFuzzyFILEOWNER(){return this.rightFuzzyFILEOWNER;}
        private List<String> DESCRIPTIONList;

        public List<String> getDESCRIPTIONList(){return this.DESCRIPTIONList;}


        private List<String> fuzzyDESCRIPTION;

        public List<String> getFuzzyDESCRIPTION(){return this.fuzzyDESCRIPTION;}

        private List<String> rightFuzzyDESCRIPTION;

        public List<String> getRightFuzzyDESCRIPTION(){return this.rightFuzzyDESCRIPTION;}
        private QueryBuilder (){
            this.fetchFields = new HashMap<>();
        }

        public QueryBuilder IDBetWeen(Integer IDSt,Integer IDEd){
            this.IDSt = IDSt;
            this.IDEd = IDEd;
            return this;
        }

        public QueryBuilder IDGreaterEqThan(Integer IDSt){
            this.IDSt = IDSt;
            return this;
        }
        public QueryBuilder IDLessEqThan(Integer IDEd){
            this.IDEd = IDEd;
            return this;
        }


        public QueryBuilder ID(Integer ID){
            setID(ID);
            return this;
        }

        public QueryBuilder IDList(Integer ... ID){
            this.IDList = solveNullList(ID);
            return this;
        }

        public QueryBuilder IDList(List<Integer> ID){
            this.IDList = ID;
            return this;
        }

        public QueryBuilder fetchID(){
            setFetchFields("fetchFields","ID");
            return this;
        }

        public QueryBuilder excludeID(){
            setFetchFields("excludeFields","ID");
            return this;
        }

        public QueryBuilder fuzzyFILENAME (List<String> fuzzyFILENAME){
            this.fuzzyFILENAME = fuzzyFILENAME;
            return this;
        }

        public QueryBuilder fuzzyFILENAME (String ... fuzzyFILENAME){
            this.fuzzyFILENAME = solveNullList(fuzzyFILENAME);
            return this;
        }

        public QueryBuilder rightFuzzyFILENAME (List<String> rightFuzzyFILENAME){
            this.rightFuzzyFILENAME = rightFuzzyFILENAME;
            return this;
        }

        public QueryBuilder rightFuzzyFILENAME (String ... rightFuzzyFILENAME){
            this.rightFuzzyFILENAME = solveNullList(rightFuzzyFILENAME);
            return this;
        }

        public QueryBuilder fILENAME(String fILENAME){
            setFILENAME(fILENAME);
            return this;
        }

        public QueryBuilder fILENAMEList(String ... fILENAME){
            this.fILENAMEList = solveNullList(fILENAME);
            return this;
        }

        public QueryBuilder fILENAMEList(List<String> fILENAME){
            this.fILENAMEList = fILENAME;
            return this;
        }

        public QueryBuilder fetchFILENAME(){
            setFetchFields("fetchFields","fILENAME");
            return this;
        }

        public QueryBuilder excludeFILENAME(){
            setFetchFields("excludeFields","fILENAME");
            return this;
        }

        public QueryBuilder fuzzyFILEPATH (List<String> fuzzyFILEPATH){
            this.fuzzyFILEPATH = fuzzyFILEPATH;
            return this;
        }

        public QueryBuilder fuzzyFILEPATH (String ... fuzzyFILEPATH){
            this.fuzzyFILEPATH = solveNullList(fuzzyFILEPATH);
            return this;
        }

        public QueryBuilder rightFuzzyFILEPATH (List<String> rightFuzzyFILEPATH){
            this.rightFuzzyFILEPATH = rightFuzzyFILEPATH;
            return this;
        }

        public QueryBuilder rightFuzzyFILEPATH (String ... rightFuzzyFILEPATH){
            this.rightFuzzyFILEPATH = solveNullList(rightFuzzyFILEPATH);
            return this;
        }

        public QueryBuilder fILEPATH(String fILEPATH){
            setFILEPATH(fILEPATH);
            return this;
        }

        public QueryBuilder fILEPATHList(String ... fILEPATH){
            this.fILEPATHList = solveNullList(fILEPATH);
            return this;
        }

        public QueryBuilder fILEPATHList(List<String> fILEPATH){
            this.fILEPATHList = fILEPATH;
            return this;
        }

        public QueryBuilder fetchFILEPATH(){
            setFetchFields("fetchFields","fILEPATH");
            return this;
        }

        public QueryBuilder excludeFILEPATH(){
            setFetchFields("excludeFields","fILEPATH");
            return this;
        }

        public QueryBuilder fuzzyFILEOWNER (List<String> fuzzyFILEOWNER){
            this.fuzzyFILEOWNER = fuzzyFILEOWNER;
            return this;
        }

        public QueryBuilder fuzzyFILEOWNER (String ... fuzzyFILEOWNER){
            this.fuzzyFILEOWNER = solveNullList(fuzzyFILEOWNER);
            return this;
        }

        public QueryBuilder rightFuzzyFILEOWNER (List<String> rightFuzzyFILEOWNER){
            this.rightFuzzyFILEOWNER = rightFuzzyFILEOWNER;
            return this;
        }

        public QueryBuilder rightFuzzyFILEOWNER (String ... rightFuzzyFILEOWNER){
            this.rightFuzzyFILEOWNER = solveNullList(rightFuzzyFILEOWNER);
            return this;
        }

        public QueryBuilder fILEOWNER(String fILEOWNER){
            setFILEOWNER(fILEOWNER);
            return this;
        }

        public QueryBuilder fILEOWNERList(String ... fILEOWNER){
            this.fILEOWNERList = solveNullList(fILEOWNER);
            return this;
        }

        public QueryBuilder fILEOWNERList(List<String> fILEOWNER){
            this.fILEOWNERList = fILEOWNER;
            return this;
        }

        public QueryBuilder fetchFILEOWNER(){
            setFetchFields("fetchFields","fILEOWNER");
            return this;
        }

        public QueryBuilder excludeFILEOWNER(){
            setFetchFields("excludeFields","fILEOWNER");
            return this;
        }

        public QueryBuilder fuzzyDESCRIPTION (List<String> fuzzyDESCRIPTION){
            this.fuzzyDESCRIPTION = fuzzyDESCRIPTION;
            return this;
        }

        public QueryBuilder fuzzyDESCRIPTION (String ... fuzzyDESCRIPTION){
            this.fuzzyDESCRIPTION = solveNullList(fuzzyDESCRIPTION);
            return this;
        }

        public QueryBuilder rightFuzzyDESCRIPTION (List<String> rightFuzzyDESCRIPTION){
            this.rightFuzzyDESCRIPTION = rightFuzzyDESCRIPTION;
            return this;
        }

        public QueryBuilder rightFuzzyDESCRIPTION (String ... rightFuzzyDESCRIPTION){
            this.rightFuzzyDESCRIPTION = solveNullList(rightFuzzyDESCRIPTION);
            return this;
        }

        public QueryBuilder DESCRIPTION(String DESCRIPTION){
            setDESCRIPTION(DESCRIPTION);
            return this;
        }

        public QueryBuilder DESCRIPTIONList(String ... DESCRIPTION){
            this.DESCRIPTIONList = solveNullList(DESCRIPTION);
            return this;
        }

        public QueryBuilder DESCRIPTIONList(List<String> DESCRIPTION){
            this.DESCRIPTIONList = DESCRIPTION;
            return this;
        }

        public QueryBuilder fetchDESCRIPTION(){
            setFetchFields("fetchFields","DESCRIPTION");
            return this;
        }

        public QueryBuilder excludeDESCRIPTION(){
            setFetchFields("excludeFields","DESCRIPTION");
            return this;
        }
        private <T>List<T> solveNullList(T ... objs){
            if (objs != null){
            List<T> list = new ArrayList<>();
                for (T item : objs){
                    if (item != null){
                        list.add(item);
                    }
                }
                return list;
            }
            return null;
        }

        public QueryBuilder fetchAll(){
            this.fetchFields.put("AllFields",true);
            return this;
        }

        public QueryBuilder addField(String ... fields){
            List<String> list = new ArrayList<>();
            if (fields != null){
                for (String field : fields){
                    list.add(field);
                }
            }
            this.fetchFields.put("otherFields",list);
            return this;
        }
        @SuppressWarnings("unchecked")
        private void setFetchFields(String key,String val){
            Map<String,Boolean> fields= (Map<String, Boolean>) this.fetchFields.get(key);
            if (fields == null){
                fields = new HashMap<>();
            }
            fields.put(val,true);
            this.fetchFields.put(key,fields);
        }

        public DAPORTFILE build(){return this;}
    }


    public static class ConditionBuilder{
        private List<Integer> IDList;

        public List<Integer> getIDList(){return this.IDList;}

        private Integer IDSt;

        private Integer IDEd;

        public Integer getIDSt(){return this.IDSt;}

        public Integer getIDEd(){return this.IDEd;}

        private List<String> fILENAMEList;

        public List<String> getFILENAMEList(){return this.fILENAMEList;}


        private List<String> fuzzyFILENAME;

        public List<String> getFuzzyFILENAME(){return this.fuzzyFILENAME;}

        private List<String> rightFuzzyFILENAME;

        public List<String> getRightFuzzyFILENAME(){return this.rightFuzzyFILENAME;}
        private List<String> fILEPATHList;

        public List<String> getFILEPATHList(){return this.fILEPATHList;}


        private List<String> fuzzyFILEPATH;

        public List<String> getFuzzyFILEPATH(){return this.fuzzyFILEPATH;}

        private List<String> rightFuzzyFILEPATH;

        public List<String> getRightFuzzyFILEPATH(){return this.rightFuzzyFILEPATH;}
        private List<String> fILEOWNERList;

        public List<String> getFILEOWNERList(){return this.fILEOWNERList;}


        private List<String> fuzzyFILEOWNER;

        public List<String> getFuzzyFILEOWNER(){return this.fuzzyFILEOWNER;}

        private List<String> rightFuzzyFILEOWNER;

        public List<String> getRightFuzzyFILEOWNER(){return this.rightFuzzyFILEOWNER;}
        private List<String> DESCRIPTIONList;

        public List<String> getDESCRIPTIONList(){return this.DESCRIPTIONList;}


        private List<String> fuzzyDESCRIPTION;

        public List<String> getFuzzyDESCRIPTION(){return this.fuzzyDESCRIPTION;}

        private List<String> rightFuzzyDESCRIPTION;

        public List<String> getRightFuzzyDESCRIPTION(){return this.rightFuzzyDESCRIPTION;}

        public ConditionBuilder IDBetWeen(Integer IDSt,Integer IDEd){
            this.IDSt = IDSt;
            this.IDEd = IDEd;
            return this;
        }

        public ConditionBuilder IDGreaterEqThan(Integer IDSt){
            this.IDSt = IDSt;
            return this;
        }
        public ConditionBuilder IDLessEqThan(Integer IDEd){
            this.IDEd = IDEd;
            return this;
        }


        public ConditionBuilder IDList(Integer ... ID){
            this.IDList = solveNullList(ID);
            return this;
        }

        public ConditionBuilder IDList(List<Integer> ID){
            this.IDList = ID;
            return this;
        }

        public ConditionBuilder fuzzyFILENAME (List<String> fuzzyFILENAME){
            this.fuzzyFILENAME = fuzzyFILENAME;
            return this;
        }

        public ConditionBuilder fuzzyFILENAME (String ... fuzzyFILENAME){
            this.fuzzyFILENAME = solveNullList(fuzzyFILENAME);
            return this;
        }

        public ConditionBuilder rightFuzzyFILENAME (List<String> rightFuzzyFILENAME){
            this.rightFuzzyFILENAME = rightFuzzyFILENAME;
            return this;
        }

        public ConditionBuilder rightFuzzyFILENAME (String ... rightFuzzyFILENAME){
            this.rightFuzzyFILENAME = solveNullList(rightFuzzyFILENAME);
            return this;
        }

        public ConditionBuilder fILENAMEList(String ... fILENAME){
            this.fILENAMEList = solveNullList(fILENAME);
            return this;
        }

        public ConditionBuilder fILENAMEList(List<String> fILENAME){
            this.fILENAMEList = fILENAME;
            return this;
        }

        public ConditionBuilder fuzzyFILEPATH (List<String> fuzzyFILEPATH){
            this.fuzzyFILEPATH = fuzzyFILEPATH;
            return this;
        }

        public ConditionBuilder fuzzyFILEPATH (String ... fuzzyFILEPATH){
            this.fuzzyFILEPATH = solveNullList(fuzzyFILEPATH);
            return this;
        }

        public ConditionBuilder rightFuzzyFILEPATH (List<String> rightFuzzyFILEPATH){
            this.rightFuzzyFILEPATH = rightFuzzyFILEPATH;
            return this;
        }

        public ConditionBuilder rightFuzzyFILEPATH (String ... rightFuzzyFILEPATH){
            this.rightFuzzyFILEPATH = solveNullList(rightFuzzyFILEPATH);
            return this;
        }

        public ConditionBuilder fILEPATHList(String ... fILEPATH){
            this.fILEPATHList = solveNullList(fILEPATH);
            return this;
        }

        public ConditionBuilder fILEPATHList(List<String> fILEPATH){
            this.fILEPATHList = fILEPATH;
            return this;
        }

        public ConditionBuilder fuzzyFILEOWNER (List<String> fuzzyFILEOWNER){
            this.fuzzyFILEOWNER = fuzzyFILEOWNER;
            return this;
        }

        public ConditionBuilder fuzzyFILEOWNER (String ... fuzzyFILEOWNER){
            this.fuzzyFILEOWNER = solveNullList(fuzzyFILEOWNER);
            return this;
        }

        public ConditionBuilder rightFuzzyFILEOWNER (List<String> rightFuzzyFILEOWNER){
            this.rightFuzzyFILEOWNER = rightFuzzyFILEOWNER;
            return this;
        }

        public ConditionBuilder rightFuzzyFILEOWNER (String ... rightFuzzyFILEOWNER){
            this.rightFuzzyFILEOWNER = solveNullList(rightFuzzyFILEOWNER);
            return this;
        }

        public ConditionBuilder fILEOWNERList(String ... fILEOWNER){
            this.fILEOWNERList = solveNullList(fILEOWNER);
            return this;
        }

        public ConditionBuilder fILEOWNERList(List<String> fILEOWNER){
            this.fILEOWNERList = fILEOWNER;
            return this;
        }

        public ConditionBuilder fuzzyDESCRIPTION (List<String> fuzzyDESCRIPTION){
            this.fuzzyDESCRIPTION = fuzzyDESCRIPTION;
            return this;
        }

        public ConditionBuilder fuzzyDESCRIPTION (String ... fuzzyDESCRIPTION){
            this.fuzzyDESCRIPTION = solveNullList(fuzzyDESCRIPTION);
            return this;
        }

        public ConditionBuilder rightFuzzyDESCRIPTION (List<String> rightFuzzyDESCRIPTION){
            this.rightFuzzyDESCRIPTION = rightFuzzyDESCRIPTION;
            return this;
        }

        public ConditionBuilder rightFuzzyDESCRIPTION (String ... rightFuzzyDESCRIPTION){
            this.rightFuzzyDESCRIPTION = solveNullList(rightFuzzyDESCRIPTION);
            return this;
        }

        public ConditionBuilder DESCRIPTIONList(String ... DESCRIPTION){
            this.DESCRIPTIONList = solveNullList(DESCRIPTION);
            return this;
        }

        public ConditionBuilder DESCRIPTIONList(List<String> DESCRIPTION){
            this.DESCRIPTIONList = DESCRIPTION;
            return this;
        }

        private <T>List<T> solveNullList(T ... objs){
            if (objs != null){
            List<T> list = new ArrayList<>();
                for (T item : objs){
                    if (item != null){
                        list.add(item);
                    }
                }
                return list;
            }
            return null;
        }

        public ConditionBuilder build(){return this;}
    }

    public static class Builder {

        private DAPORTFILE obj;

        public Builder(){
            this.obj = new DAPORTFILE();
        }

        public Builder ID(Integer ID){
            this.obj.setID(ID);
            return this;
        }
        public Builder fILENAME(String fILENAME){
            this.obj.setFILENAME(fILENAME);
            return this;
        }
        public Builder fILEPATH(String fILEPATH){
            this.obj.setFILEPATH(fILEPATH);
            return this;
        }
        public Builder fILEOWNER(String fILEOWNER){
            this.obj.setFILEOWNER(fILEOWNER);
            return this;
        }
        public Builder DESCRIPTION(String DESCRIPTION){
            this.obj.setDESCRIPTION(DESCRIPTION);
            return this;
        }
        public DAPORTFILE build(){return obj;}
    }

}
